package com.umeng;

import android.content.Context;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import com.ss.android.common.app.AbsApplication;

public class VersonUtil {
    public static String sUmengChannel;
    public static String sVersionCode;
    public static String sVersionName;

    public VersonUtil() {

    }

    public static String getUmengChannel() {
        String v0;
        if(VersonUtil.sUmengChannel != null) {
            v0 = VersonUtil.sUmengChannel;
            return v0;
        }

        String v1 = "Unknown";
        try {
            Context v0_2 = AbsApplication.getCtx().getApplicationContext();
            ApplicationInfo v0_3 = v0_2.getPackageManager().getApplicationInfo(v0_2.getPackageName(), 128);
            if(v0_3 == null) {
                return v1;
            }

            if(v0_3.metaData == null) {
                return v1;
            }

            Object v0_4 = v0_3.metaData.get("UMENG_CHANNEL");
            if(v0_4 == null) {
                return v1;
            }

            v0 = v0_4.toString();
            if(v0 == null) {
                return v1;
            }
        }
        catch(Throwable v0_1) {
            return v1;
        }

        return v0;
    }

    public static String getVersionCode() {
        String v0;
        if(VersonUtil.sVersionCode != null) {
            v0 = VersonUtil.sVersionCode;
            return v0;
        }

        try {
            Context v0_2 = AbsApplication.getCtx().getApplicationContext();
            v0 = String.valueOf(v0_2.getPackageManager().getPackageInfo(v0_2.getPackageName(), 0).versionCode);
        }
        catch(PackageManager.NameNotFoundException v0_1) {
            v0 = "";
        }

        return v0;
    }

    public static String getVersionName() {
        String v0;
        if(VersonUtil.sVersionName != null) {
            v0 = VersonUtil.sVersionName;
            return v0;
        }

        try {
            Context v0_2 = AbsApplication.getCtx().getApplicationContext();
            v0 = v0_2.getPackageManager().getPackageInfo(v0_2.getPackageName(), 0).versionName;
        }
        catch(PackageManager.NameNotFoundException v0_1) {
            v0 = "";
        }

        return v0;
    }
}

